<template>
  <div class="user-detail">
    <div>
      <div class="form-item" v-for="item in userDetailForm" :key="item.key">
        <span class="form-item__label">{{ item.label }}：</span>
        <span class="form-item__content">{{
          item.map?.[record[item.key]] || record[item.key]
        }}</span>
      </div>
    </div>
    <a-carousel v-if="record.credentials?.length" arrows>
      <template #prevArrow>
        <div class="custom-slick-arrow left-arrow">
          <left-circle-outlined />
        </div>
      </template>
      <template #nextArrow>
        <div class="custom-slick-arrow right-arrow">
          <right-circle-outlined />
        </div>
      </template>
      <a-image
        v-for="(item, index) in record.credentials"
        :key="index"
        :src="'/file/read/' + item"
        fallback=""
      />
    </a-carousel>
  </div>
</template>
<script lang="ts" setup>
import { userDetailForm } from "../config";
defineProps<{
  record: Record<string, any>;
}>();
</script>
<style lang="scss" scoped>
.user-detail {
  width: 100%;
  display: flex;
  flex-flow: row nowrap;
  & > * {
    flex: 1;
    width: 0;
  }
}
.form-item__label {
  width: 100px;
  text-align: right;
  margin-right: 24px;
}
:deep(.slick-slider),
:deep(.slick-slider > .slick-list),
:deep(.slick-slider > .slick-list *) {
  height: 100%;
}
.custom-slick-arrow {
  width: 25px;
  height: 25px;
  font-size: 25px;
  color: rgba(0, 0, 0, 0.3);
  opacity: 0.3;
  z-index: 1;
  &::before,
  &::after {
    display: none;
  }
  &.left-arrow {
    left: 10px;
  }
  &.right-arrow {
    right: 10px;
  }
  &:hover {
    color: rgba(0, 0, 0, 0.5);
  }
}
</style>
